<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>用户登录</title>
    <link rel="stylesheet" href="/css/bootstrap.css">

    <script src="/js/jquery-3.6.1.min.js"></script>
    <script src="/js/bootstrap.min.js"></script>
    <style>
        b{
            font-weight: bolder;
            color: red;
        }
    </style>
    <link rel="stylesheet" href="/plugins/bootstrapetable/bootstrap-table.min.css">

</head>
<body>
<div class="container-fluid">
    <div  class="panel panel-default">
        <div class="panel panel-heading">用户登录界面</div>
        <div class="panel-body">

            <form>
                <div class="form-group">
                    <label for="username">用户名:</label>
                    <input type="text" class="form-control" id="username" name="username" placeholder="用户名">
                </div>
                <div class="form-group">
                    <label for="password">密码:</label>
                    <input type="password" class="form-control" id="password" name="password" placeholder="密码">
                </div>
                <button type="button" class="btn btn-default" onclick="login();">登录</button>
            </form>
        </div>
    </div>
</div>
<script type="text/javascript">
    function login(){
        var name=$("#username").val();
        var password=$("#password").val();

        $.ajax({
            url:"/webapi/login/user",
            data:{
                username:name,
                password:password
            }
        }).done(function (rs){
            if(rs>=0){
                window.location.href="/student/list";
            }else{
                alert("密码错误！请输入正确的用户名密码！");
            }
        });
    }
</script>




</body>
</html>